package com.lottery.im.module.chat.adapter;

import android.support.annotation.Nullable;
import android.text.TextUtils;
import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lottery.im.R;
import com.lottery.im.api.Api;
import com.lottery.im.api.result.entity.ActiveInfo;
import com.lottery.im.widget.shapeimageview.CustomShapeImageView;
import java.util.List;

/*
 *  消息界面 下拉广告adapter
 * */
public class ExtendHeaderAdapter extends BaseQuickAdapter<ActiveInfo, BaseViewHolder> {

  public ExtendHeaderAdapter(@Nullable List<ActiveInfo> data) {
    super(R.layout.item_extend_header, data);
  }

  @Override protected void convert(BaseViewHolder helper, ActiveInfo item) {

    CustomShapeImageView ivIcon = helper.getView(R.id.iv_icon);
    Glide.with(mContext)
        .load(Api.BASEADDRESS + item.getImageUrl())
        .into(ivIcon);

    if (!TextUtils.isEmpty(item.getName())) {
      helper.setText(R.id.tv_title, item.getName());
    } else {
      helper.setText(R.id.tv_title, "");
    }
  }
}
